package com.help.knowhelps.ui;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import com.help.knowhelps.R;

public class OthersHelpDetailActivity extends Activity{
	View iv_camera,tv_send ;
	EditText et_entity;
	private ListView lv_answer;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.others_helps_detail_activity);
		initComponent();
	}
	private void initComponent()
	{
		UiUtils.InitActionBar(this, "咨询问题", UiUtils.ACTIONBAR_BUTTON_DEFAULT, 
				UiUtils.ACTIONBAR_BUTTON_DISAPPEAR ,clicklistener);
		lv_answer= (ListView) findViewById(R.id.others_helps_detail_listView);
		iv_camera = findViewById(R.id.inputlayout_imageView_camera);
		et_entity = (EditText) findViewById(R.id.inputlayout_editText_entity);
		tv_send = findViewById(R.id.inputlayout_textView_send);
		iv_camera.setOnClickListener(clicklistener);
		tv_send.setOnClickListener(clicklistener);
		
		
		
//		InitUser(iconDrawalbe,UserName)    // do...      传递当前所查看用户的头像和名字
//		HelpDetailAdapter detailadapter = new HelpDetailAdapter();
//		lv_answer.setAdapter(detailadapter);
	}
//	private void InitUser(Record record)    //单条帮助信息.
//	{
//		if(null == iconDrawalbe |null == UserName) //异常处理
//		{d
//			Toast.makeText(OthersHelpDetailActivity.this, "读取用户信息失败,请重新尝试!", Toast.LENGTH_SHORT).show();
//			finish();
//		}
//		iv_icon = (ImageView) findViewById(R.id.others_helps_detail_imageView_icon);
//		tv_name = (TextView) findViewById(R.id.others_helps_detail_textView_Name);
//		tv_time = (TextView) findViewById(R.id.others_helps_detail_time);
//		tv_entity = (TextView) findViewById(R.id.others_helps_detail_entity);
//		ll_pictures = (LinearLayout) findViewById(R.id.others_helps_detail_pictures_layout);
//		
//		
//		if(null != record.getPictureList() && record.getPictureList().length != 0)//配置图片列表
//		{
//			holder.ll_pictures.setVisibility(View.VISIBLE);
//			for(String picture : record.getPictureList())
//			{
//				ImageView iv_temp = new ImageView(context);
//				iv_temp.setImageBitmap(Utils.convertToBitmap(picture,Utils.dip2px(context, 44) ,Utils.dip2px(context, 44)));
//				holder.ll_pictures.addView(iv_temp, params);
//			}
//		}else
//		{
//			holder.ll_pictures.setVisibility(View.GONE);
//		}
//		
//		tv_time.setText(Record.getTime());
//		iv_icon.setImageDrawable(iconDrawalbe);
//		tv_name.setText(UserName);
//	}
	private OnClickListener clicklistener = new OnClickListener() {
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.actionbar_imageView_left:
				finish();
				break;
			case R.id.inputlayout_imageView_camera:
				// do ...   Intent 相册
				startActivityForResult(new Intent(OthersHelpDetailActivity.this,ImageSelectorActivity.class),0x110);
				break;
			case R.id.inputlayout_textView_send:
				String entity = null;
				try{
					entity = et_entity.getText().toString();
				}catch (Exception e) {
					// TODO: handle exception
				}
				if(null == entity)
					Toast.makeText(OthersHelpDetailActivity.this, "请输入回复内容后,再次提交!", Toast.LENGTH_SHORT).show();
				else
				{
					// do...     提交回复内容至服务器
				}
				break;
			default:
				break;
			}
		}
	};
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		
	};
}
